import React, {useEffect, useState} from "react";
import OrderLIstView from "../OrderLIstView";
import api from "../../../api";
import OrderListView from "../OrderLIstView";

const OrderList=(props)=>{

    const [orderList,setOrderList]=useState([])

    useEffect(()=>{
        api.order({
            username:props.city
        }).then(res=>{
            if (res.data.status===200){
               setOrderList(res.data.result)
            }
        })
    },[])

    return(
        <div>
            {
                orderList.length>0?
                    <OrderListView data={orderList} city={props.city}/>:
                    <div>等待Order列表的数据加载中......</div>
            }
        </div>


    )
}
export default OrderList